package fr.umlv.android.boggle.service;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import fr.umlv.android.boggle.model.BoggleModel;

public class BoggleService extends Service {
	
	private BoggleModel model;
	private final IBinder binder = new BoggleServiceBinder();
	
	private int randomInteger; 
	
	
	private Thread thread = new Thread(new Runnable() {
		@Override
		public void run() {
		}
	});
	
	
	
	@Override
	public void onCreate() {
//		System.out.println("ssssssssssssssssssssssssssssssssssssss");
//		Resources res = getResources();
//        InputStream inputStreamDico = res.openRawResource(R.raw.dico_boggle);
//        model = new BoggleModelImpl(inputStreamDico);
		super.onCreate();
		setRandomInteger(5);
	}
	
	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {	

		System.out.println("ssssssssssssssssssssssssssssssssssssss");
		System.out.println("onSTARTCOMMAND Before Thread.start");

		thread.start();
		
		System.out.println("onSTARTCOMMAND after Thread.start");

		return START_STICKY;
	}
	
	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}

	@Override
	public IBinder onBind(Intent arg0) {
		return binder;
	}
	

	public class BoggleServiceBinder extends Binder {

		public BoggleService getService() {
			return BoggleService.this;
		}
	}
	
	
	
	
	public BoggleModel getModel() {
		return model;
	}

	public void setRandomInteger(int randomInteger) {
		this.randomInteger = randomInteger;
	}

	public int getRandomInteger() {
		return randomInteger;
	}

}
